var APF = {
	log : function(A) {
	}
};
APF.Namespace = {
	register : function(D) {
		var C = D.split(".");
		var A = window;
		for ( var B = 0; B < C.length; B++) {
			if (typeof A[C[B]] == "undefined") {
				A[C[B]] = new Object()
			}
			A = A[C[B]]
		}
	}
};
APF.Utils = {
	getWindowSize : function() {
		var B = 0, A = 0;
		if (typeof (window.innerWidth) == "number") {
			B = window.innerWidth;
			A = window.innerHeight
		} else {
			if (document.documentElement
					&& (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
				B = document.documentElement.clientWidth;
				A = document.documentElement.clientHeight
			} else {
				if (document.body
						&& (document.body.clientWidth || document.body.clientHeight)) {
					B = document.body.clientWidth;
					A = document.body.clientHeight
				}
			}
		}
		return {
			width : B,
			height : A
		}
	},
	getScroll : function() {
		var B = 0, A = 0;
		if (typeof (window.pageYOffset) == "number") {
			A = window.pageYOffset;
			B = window.pageXOffset
		} else {
			if (document.body
					&& (document.body.scrollLeft || document.body.scrollTop)) {
				A = document.body.scrollTop;
				B = document.body.scrollLeft
			} else {
				if (document.documentElement
						&& (document.documentElement.scrollLeft || document.documentElement.scrollTop)) {
					A = document.documentElement.scrollTop;
					B = document.documentElement.scrollLeft
				}
			}
		}
		return {
			left : B,
			top : A
		}
	},
	setCookie : function(C, E, A, H, D, G) {
		var B = new Date();
		B.setTime(B.getTime());
		if (A) {
			A = A * 1000 * 60 * 60 * 24
		}
		var F = new Date(B.getTime() + (A));
		document.cookie = C + "=" + escape(E)
				+ ((A) ? ";expires=" + F.toGMTString() : "")
				+ ((H) ? ";path=" + H : "") + ((D) ? ";domain=" + D : "")
				+ ((G) ? ";secure" : "")
	},
	getCookie : function(A) {
		var F = document.cookie.split(";");
		var B = "";
		var D = "";
		var E = "";
		var C = false;
		for (i = 0; i < F.length; i++) {
			B = F[i].split("=");
			D = B[0].replace(/^\s+|\s+$/g, "");
			if (D == A) {
				C = true;
				if (B.length > 1) {
					E = unescape(B[1].replace(/^\s+|\s+$/g, ""))
				}
				return E;
				break
			}
			B = null;
			D = ""
		}
		if (!C) {
			return null
		}
	},
	deleteCookie : function(A, C, B) {
		if (this.getCookie(A)) {
			document.cookie = A + "=" + ((C) ? ";path=" + C : "")
					+ ((B) ? ";domain=" + B : "")
					+ ";expires=Thu, 01-Jan-1970 00:00:01 GMT"
		}
	}
};
APF.Namespace.register("haozu.global.header");
haozu.global.header.CitySelector = Class
		.create( {
			initialize : function(D, C, A) {
				this.selector = $(D);
				this.panelId = C;
				this.hideTimeout = A;
				this.url = $(D + "_url").value;
				var B = $(C);
				this.iframe = B.select("iframe").first();
				this.iframe.setStyle( {
					width : B.getWidth() + "px",
					height : B.getHeight() + "px"
				});
				this.selector.observe("mouseover", function() {
					window.clearTimeout(this.timeoutHandle);
					$(this.panelId).show();
					if ($("p1_p1")) {
						$("p1_p1").style.visibility = "hidden"
					}
				}.bind(this));
				this.selector
						.observe(
								"mouseout",
								function() {
									window.clearTimeout(this.timeoutHandle);
									this.timeoutHandle = window
											.setTimeout(
													"$('"
															+ this.panelId
															+ "').hide(); if($('p1_p1')){$('p1_p1').style.visibility='visible';}",
													this.hideTimeout)
								}.bind(this));
				var E = this.selector.select("a").first();
				if (E != undefined) {
					E.observe("click", function(F) {
						window.location.href = this.url
					}.bind(this))
				}
			}
		});
APF.Namespace.register("haozu.global.header");
haozu.global.header.SearchButton = Class.create( {
	initialize : function(E, B, D, A, C) {
		this.trigger = $(E);
		this.textbox = $(B);
		this.option = $(D);
		this.droplist = $(A);
		this.kw = $(C);
		this.option.observe("mouseover", function() {
			this.option.addClassName("current_option_hover")
		}.bind(this));
		this.option.observe("mouseout", function() {
			this.option.removeClassName("current_option_hover")
		}.bind(this));
		this.trigger.observe("click", function() {
			if (this.droplist.style.display == "none") {
				this.droplist.show()
			} else {
				this.droplist.hide()
			}
		}.bind(this));
		Event.observe(this.kw, "focus", function() {
			this.droplist.hide();
			if (this.kw.value == "想租房？输入关键字试试") {
				this.kw.value = "";
				this.kw.style.color = "#000000"
			} else {
				this.kw.style.color = "#000000"
			}
		}.bind(this));
		Event.observe(this.kw, "blur", function() {
			if (this.kw.value == "") {
				this.kw.value = "想租房？输入关键字试试";
				this.kw.style.color = "#999999"
			}
		}.bind(this));
		Event.observe(document, "click", function(F) {
			if (this.droplist.style.display == "none") {
				return false
			} else {
				var F = window.event ? window.event : F;
				target = F.srcElement || F.target;
				if (target.id != A && target.id != D) {
					this.droplist.hide()
				} else {
					this.droplist.show()
				}
			}
		}.bind(this))
	},
	selected : function(A, B) {
		this.textbox.value = A;
		this.option.value = B;
		this.removeclass();
		$("aselected" + A).addClassName("selected");
		this.droplist.hide();
		this.kw.style.color = "#999999";
		this.kw.value = "想租房？输入关键字试试"
	},
	removeclass : function() {
		for (i = 1; i < 3; i++) {
			$("aselected" + i).removeClassName("selected")
		}
	}
});
APF.Namespace.register("haozu.global.header");
haozu.global.header.searchinput = Class.create( {
	initialize : function(A) {
		this.id = A;
		this.kw = $(A + "_kw");
		Event.observe(this.kw, "focus", function() {
			if (this.kw.value == "想租房？输入关键字试试") {
				this.kw.value = "";
				this.kw.style.color = "#000000"
			} else {
				this.kw.style.color = "#000000"
			}
		}.bind(this));
		Event.observe(this.kw, "blur", function() {
			if (this.kw.value == "") {
				this.kw.value = "想租房？输入关键字试试";
				this.kw.style.color = "#999999"
			}
		}.bind(this));
		Event.observe(this.id + "_button", "click", function() {
			this.kw.value = "";
			$(this.id + "_form").action = "/map/listing/";
			window.location.href = "/map/listing/"
		}.bind(this))
	},
	_theEnd : undefined
});